#pragma once
#include <iostream>
#include <conio.h>
#include <vector>
#include "SDL.h"
#include "SDLRenderer.h"
#include "SDLComponent.h"
#include "SDLInput.h"
#include "SDLTimer.h"
#include "SDLAudio.h"
#include "SDL_ttf.h"
#include "SDLResources.h"
#include "XMLReader.h"
#include "time.h"
class SDLEngine
{
#pragma region SINGLETON
public:
	static SDLEngine* GetInstance()
	{
		if(instance == nullptr)
		{
			instance = new SDLEngine();
		}
		return instance;
	}
	static void Kill()
	{
		delete instance;
		instance = nullptr;
	}
private:
	static SDLEngine* instance;

	SDLEngine();
	SDLEngine(const SDLEngine& r);
	~SDLEngine();

	SDLEngine& operator=(const SDLEngine& r);
#pragma endregion
public:
	friend class SDLComponent;
	friend class SDLSprite;

	void Init();
	void Init(int, int);
	void Start();
	void Stop();

	void Update();
	void Draw();

	void SetIsRunning(bool isrun){isRunning = false;}

private:
	bool isRunning;
	static const int ESCAPE = 27;

	std::vector<SDLComponent*> allComponents;

	//void Update();
	//void Draw();
};

